import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../view/login'
import home from '../view/home'

Vue.use(VueRouter);

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new VueRouter({
  mode: 'history',//去掉#号
  routes: [
    {
      path: '/',
      component: login,
    },
    {
      path: '/home',
      component: home
    }
  ]
})
